Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@manypkg/find-root
Advanced tools
@manypkg/find-root is an npm package designed to help you find the root directory of a monorepo or a project. This can be particularly useful in monorepo setups where you need to determine the root directory from a nested package.
Find the root directory of a monorepo
This feature allows you to find the root directory of a monorepo starting from the current working directory. The `findRoot` function will traverse up the directory tree until it finds the root directory.
const findRoot = require('@manypkg/find-root');
const rootDir = findRoot(process.cwd());
console.log(rootDir);
Find the root directory with a custom start path
This feature allows you to specify a custom start path from which to begin the search for the root directory. This can be useful if you want to find the root directory from a specific location in your project.
const findRoot = require('@manypkg/find-root');
const rootDir = findRoot('/path/to/start');
console.log(rootDir);
The `find-root` package is a similar utility that helps you find the root directory of a project by looking for a specific file (like `package.json`). It is simpler and more focused on finding the root directory based on the presence of a file, whereas @manypkg/find-root is more tailored for monorepo setups.
The `pkg-dir` package finds the root directory of a Node.js project by looking for the nearest `package.json` file. It is similar to @manypkg/find-root but is more general-purpose and not specifically designed for monorepos.
Find the root of a monorepo with Yarn workspaces, Bolt or pnpm
yarn add @manypkg/find-root
import { findRoot, findRootSync } from "@manypkg/find-root";
let dir = await findRoot(process.cwd());
let dir = findRootSync(process.cwd());
FAQs
> Find the root of a monorepo with Yarn workspaces, Bolt, Lerna, pnpm or Rush
We found that @manypkg/find-root demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.